home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / fortran / pcrng.zip / PCRNG.DOC < prev    next >
Text File  |  1990-06-29  |  3KB  |  66 lines

  1.            A Random Number Generator for PC's.
  2.            -----------------------------------
  3.  
  4. Some time ago, someone posted a version of Marsaglia's Universal Random
  5. Number Generator. This is one of the best generators, widely used. It is
  6. described in "Toward a universal random number generator", Statistics and
  7. Probability Letters, Vol 8, 35-39. Versions have been written in fortran,
  8. basic, ada, pascal, C and assembler. This generator has the advantage of
  9. providing exactly the same sequence of random bits in virtually all
  10. computers, but it suffers from the disadvantage of returning uniform real
  11. numbers constrained to the range 0/2^24 to (2^24-1)2^24. This is a serious
  12. disadvantage in some applications: large samples should include uniform
  13. numbers between 0 and 2^-24 once in a while; the Universal generator cannot.
  14. Furthermore, the Universal generator returns zero about once in 16 million
  15. times, too often for some uses, especially when taking logarithms.
  16.  
  17. A new generator developed by Marsaglia and his colleagues (Zaman and
  18. Narasimhan) does not suffer from these disadvantages. It passes all the
  19. stringent tests for randomness in Diehard, their battery of tests. It has
  20. an incredibly long period, some 2^1407 32-bit random integers, and has fewer
  21. storage requirements than the Universal generator.
  22.  
  23. Two assembler routines for this generator have been developed specifically
  24. for PC's. They are described in "A Random Number Generator for PC's" by G.
  25. Marsaglia, B. Narasimhan and A. Zaman, Computer Physics Communications (in
  26. press). The two assembler programs are:
  27.  
  28. LAUNI.ASM, for use with the Lahey Fortran Compiler (V 2.22 and greater),
  29.           and
  30. RMUNI.ASM, for use with IBM/2 (Ryan McFarland) Fortran Compiler.
  31.  
  32. Here is a short description of the entry points to the routines:
  33.  
  34. Routine    Purpose                       How to use it.
  35. -------    -------                       --------------
  36. RINIT      Initializes table and other   CALL RINIT(K)
  37.            values.                       where K is an 8-digit integer.
  38.                                          If RINIT is not called, default
  39.                                          values are used.
  40.  
  41. UNI        Returns a uniform real        X = UNI()
  42.            in [0,1).
  43.  
  44. VNI        Returns a uniform real        X = VNI()
  45.            in (-1,1).
  46.  
  47. IVNI       Returns a uniform integer     J = IVNI()
  48.            between -2^31 and 2^31-1.
  49.  
  50. IUNI       Returns a uniform integer     J = IUNI()
  51.            between 0 and 2^31-1.
  52.  
  53. We invite readers to provide versions for other fortran compilers.
  54.  
  55. -----------------------------------------------------------------------
  56. George Marasaglia     geo@stat.fsu.edu
  57. B. Narasimhan         naras@stat.fsu.edu
  58. Arif Zaman            arif@stat.fsu.edu
  59.  
  60. Supercomputer Computations Research Institute
  61.     and
  62. Department of Statistics
  63. Florida State University
  64. Tallahassee, FL 32306
  65. -----------------------------------------------------------------------
  66.